package cn.offcn.converter;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author yuliantao
 * @create 2020 -09 -2020-09-17 19:25
 * @description 功能描述
 */

    public class DateConverter implements Converter<String, Date> {

        @Override
        public Date convert(String source) {
            try {
                SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
                return sdf.parse(source);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            return null;
        }
    }

